using Services.Activity.WebApi.Services;
using Services.Initial.Extensions;
using Services.Initial.Options;

var builder = WebApplication.CreateBuilder(args);

builder.ConfigureDbConfiguration();
builder.ConfigureExtraServices(new InitializerOptions("../Log/WebApi","Activity.WebApi"));
builder.Services.AddSwaggerGen(c =>
{
    c.SwaggerDoc("v1", new() { Title = "Activity.WebAPi", Version = "V1" });
});
//添加数据保护
builder.Services.AddDataProtection();
//注册后台服务
builder.Services.AddHostedService<ActivityServices>();

// 注册局域网访问IP端口
builder.WebHost.ConfigureKestrel(serverOptions =>
{
    serverOptions.ListenAnyIP(7222, listenOptions =>
    {
        listenOptions.UseHttps();
    });
});

var app = builder.Build();
//使用wwwroot
app.UseStaticFiles();
// Configure the HTTP request pipeline.
app.UseMyDefault("Activity");

app.Run();
